import {html, TemplateResult} from 'lit';
import type {Meta, StoryObj} from '@storybook/web-components';
import "../../../echarts/funnel/lit-funnel.ts"
import {FunnelProps} from "../../../echarts/funnel/lit-funnel.ts";

const meta: Meta<FunnelProps> = {
    title: 'Echarts/LitFunnel',
    tags: ['autodocs'],
    render: (args: FunnelProps): TemplateResult => {
        return html`<lit-funnel 
            .chartId=${args.chartId}
            .width=${args.width}
            .height=${args.height}
            .title=${args.title}
            .tooltip=${args.tooltip}
            .legend=${args.legend}
            .sort=${args.sort}
            .seriesData=${args.seriesData}
        />`;
    },
    argTypes: {
        chartId: { control: 'text' },
        width: { control: 'text' },
        height: { control: 'text' },
        title: { control: 'object' },
        tooltip: { control: 'object' },
        legend: { control: 'object' },
        sort: { control: 'text' },
        seriesData: { control: 'object' },
    },
};

export default meta;
type Story = StoryObj<FunnelProps>;

export const BasicFunnel: Story = {
    args: {
        chartId: 'basic-funnel-chart',
        width: '1200px',
        height: '600px',
        title: {
            text: 'Funnel'
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c}%'
        },
        legend: ['Show', 'Click', 'Visit', 'Inquiry', 'Order'],
        sort: 'descending',
        seriesData: [
            { value: 60, name: 'Visit' },
            { value: 40, name: 'Inquiry' },
            { value: 20, name: 'Order' },
            { value: 80, name: 'Click' },
            { value: 100, name: 'Show' }
        ]
    }
};